/**
 * 
 */
package cn.wangsy.zhidao.p20170406;

import java.util.Scanner;

/**
 * @author wangsy
 * @date 2017年4月6日上午11:51:53
 */
public class HomeWork {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		//3.
		int sum = 0;
		for(int i = 1;i <= 5;i++){
			sum += factorial(i);
		}
		System.out.println("结果为："+sum);
		
		
		//4.
		int min = Integer.MAX_VALUE;
		Scanner scanner = new Scanner(System.in);
		for(int i = 0;i < 10;i++){
			int n = scanner.nextInt();
			if(n <= 0){
				i--;
				continue;
			}
			if(min > n){
				min = n;
			}
		}
		System.out.println("10个正整数中最小值为："+min);
		
		//5.
		for(int i = 100; i < 1000;i++){
			if(narcissus(i)){
				System.out.println(i);
			}
		}
		
	}

	public static int factorial1(int n){
		if(n == 0){
			return 1;
		}
		return n * factorial(n-1);
	}
	
	public static int factorial(int n){
		int result = 1;
		for(int i = 1;i <= n;i++){
			result *= i; 
		}
		return result;
	}
	
	public static boolean narcissus(int n){
		int temp = n;
		int a = n/100;//获取百位
		n%=100;
		int b = n/10;//获取十位
		int c = n%10;
		return a*a*a + b*b*b + c*c*c == temp;
	}
	
}
